/*   1:    */ package com.rinsi.app.zhcx.qycx;
/*   2:    */ 
/*   3:    */ import com.rinsi.core.service.CoreSimpleService;
/*   4:    */ import com.rinsi.util.AssertUtil;
/*   5:    */ import com.rinsi.util.MapUtil;
/*   6:    */ import java.util.LinkedList;
/*   7:    */ import java.util.List;
/*   8:    */ import java.util.Map;
/*   9:    */ import org.mybatis.spring.SqlSessionTemplate;
/*  10:    */ import org.springframework.stereotype.Service;
/*  11:    */ 
/*  12:    */ @Service
/*  13:    */ public class ZhcxQycxService
/*  14:    */   extends CoreSimpleService
/*  15:    */ {
/*  16:    */   public void afterIndex(Map<String, Object> model, Map<String, Object> rMap)
/*  17:    */   {
/*  18: 20 */     Map<String, Object> params = getParams(model);
/*  19:    */     
/*  20: 22 */     Map<String, Object> config = getConfig(model);
/*  21:    */     
/*  22: 24 */     int goMkcx = ((Integer)getSqlSessionTemplate().selectOne(namespace(config) + ".goMkcx", params)).intValue();
/*  23:    */     
/*  24: 26 */     boolean isGo = goMkcx == 1;
/*  25:    */     
/*  26: 28 */     rMap.put("goMkcx", Boolean.valueOf(isGo));
/*  27:    */     
/*  28: 30 */     rMap.put("szss", getSqlSessionTemplate().selectList("Core.getCodeList", Integer.valueOf(400001)));
/*  29:    */     
/*  30: 32 */     rMap.put("azzts", getSqlSessionTemplate().selectList("Core.getCodeList", Integer.valueOf(210001)));
/*  31:    */     
/*  32: 34 */     rMap.put("qyxzs", getSqlSessionTemplate().selectList("Core.getCodeList", Integer.valueOf(400018)));
/*  33:    */     
/*  34: 36 */     rMap.put("wsdjs", getSqlSessionTemplate().selectList("Core.getCodeList", Integer.valueOf(400011)));
/*  35:    */     
/*  36: 38 */     rMap.put("shlxs", getSqlSessionTemplate().selectList("Core.getCodeList", Integer.valueOf(400015)));
/*  37:    */     
/*  38: 40 */     rMap.put("sqlbs", getSqlSessionTemplate().selectList("Core.getCodeList", Integer.valueOf(500005)));
/*  39:    */     
/*  40: 42 */     rMap.put("qycjs", getSqlSessionTemplate().selectList("Core.getCodeList", Integer.valueOf(300001)));
/*  41:    */     
/*  42: 44 */     rMap.put("bzdws", getSqlSessionTemplate().selectList("Core.getCodeList", Integer.valueOf(300003)));
/*  43:    */   }
/*  44:    */   
/*  45:    */   public Map<String, Object> list(Map<String, Object> model)
/*  46:    */   {
/*  47: 51 */     Map<String, Object> params = getParams(model);
/*  48:    */     
/*  49: 53 */     Map<String, Object> config = getConfig(model);
/*  50:    */     
/*  51: 55 */     Map<String, Object> rMap = getRMap();
/*  52:    */     try
/*  53:    */     {
/*  54: 59 */       beforeList(model);
/*  55:    */       
/*  56: 61 */       Integer page = MapUtil.getInteger(params, "page");
/*  57:    */       
/*  58: 63 */       Integer rows = MapUtil.getInteger(params, "rows");
/*  59:    */       
/*  60: 65 */       List<Map<String, Object>> datas = getSqlSessionTemplate().selectList(namespace(config) + ".list", params);
/*  61:    */       
/*  62: 67 */       List<Map<String, Object>> returnDatas = new LinkedList();
/*  63:    */       
/*  64: 69 */       StringBuffer Ids = new StringBuffer("");
/*  65: 71 */       for (Map<String, Object> map : datas)
/*  66:    */       {
/*  67: 73 */         Ids.append(map.get("ORGAN_ID") + ",");
/*  68:    */         
/*  69: 75 */         map.put("IDs", Ids.toString().substring(0, Ids.toString().length() - 1));
/*  70:    */         
/*  71: 77 */         returnDatas.add(map);
/*  72:    */       }
/*  73: 80 */       datas = null;
/*  74:    */       
/*  75: 82 */       datas = returnDatas;
/*  76:    */       
/*  77: 84 */       returnDatas = null;
/*  78: 86 */       if ((MapUtil.getInteger(config, "module.page") != null) && (MapUtil.getInteger(config, "module.page").intValue() == 1)) {
/*  79: 88 */         if (AssertUtil.isCollectionNotEmpty(datas))
/*  80:    */         {
/*  81: 90 */           rMap.put("total", Integer.valueOf(datas.size()));
/*  82:    */           
/*  83: 92 */           Integer begin = Integer.valueOf((page.intValue() - 1) * rows.intValue());
/*  84:    */           
/*  85: 94 */           Integer end = Integer.valueOf(page.intValue() * rows.intValue());
/*  86: 96 */           if (end.intValue() > datas.size()) {
/*  87: 98 */             end = Integer.valueOf(datas.size());
/*  88:    */           }
/*  89:101 */           datas = datas.subList(begin.intValue(), end.intValue());
/*  90:    */         }
/*  91:    */         else
/*  92:    */         {
/*  93:105 */           rMap.put("total", Integer.valueOf(0));
/*  94:    */         }
/*  95:    */       }
/*  96:109 */       rMap.put("datas", datas);
/*  97:    */     }
/*  98:    */     catch (Exception ex)
/*  99:    */     {
/* 100:113 */       rMap.put("success", Boolean.valueOf(false));
/* 101:115 */       if (MapUtil.getBoolean(rMap, "shoeExMessage").booleanValue()) {
/* 102:117 */         rMap.put("message", ex.getMessage());
/* 103:    */       } else {
/* 104:121 */         rMap.put("message", "展示数据列表出错！请稍后重试，或联系系统管理员！");
/* 105:    */       }
/* 106:124 */       rMap.put("ex", ex.getMessage());
/* 107:    */       
/* 108:126 */       ex.printStackTrace();
/* 109:    */     }
/* 110:129 */     afterList(model, rMap);
/* 111:    */     
/* 112:131 */     return rMap;
/* 113:    */   }
/* 114:    */   
/* 115:    */   public List<Map<String, Object>> downloadEx(Map<String, Object> model)
/* 116:    */   {
/* 117:136 */     Map<String, Object> params = getParams(model);
/* 118:    */     
/* 119:138 */     Map<String, Object> config = getConfig(model);
/* 120:    */     
/* 121:140 */     Map<String, Object> rMap = getRMap();
/* 122:    */     
/* 123:142 */     List<Map<String, Object>> datas = null;
/* 124:    */     try
/* 125:    */     {
/* 126:146 */       beforeList(model);
/* 127:    */       
/* 128:148 */       Integer page = MapUtil.getInteger(params, "page");
/* 129:    */       
/* 130:150 */       Integer rows = MapUtil.getInteger(params, "rows");
/* 131:    */       
/* 132:152 */       datas = getSqlSessionTemplate().selectList(namespace(config) + ".downloadEx", params);
/* 133:154 */       if ((MapUtil.getInteger(config, "module.page") != null) && (MapUtil.getInteger(config, "module.page").intValue() == 1)) {
/* 134:156 */         if (AssertUtil.isCollectionNotEmpty(datas))
/* 135:    */         {
/* 136:158 */           rMap.put("total", Integer.valueOf(datas.size()));
/* 137:    */           
/* 138:160 */           Integer begin = Integer.valueOf((page.intValue() - 1) * rows.intValue());
/* 139:    */           
/* 140:162 */           Integer end = Integer.valueOf(page.intValue() * rows.intValue());
/* 141:164 */           if (end.intValue() > datas.size()) {
/* 142:166 */             end = Integer.valueOf(datas.size());
/* 143:    */           }
/* 144:169 */           datas = datas.subList(begin.intValue(), end.intValue());
/* 145:    */         }
/* 146:    */         else
/* 147:    */         {
/* 148:173 */           rMap.put("total", Integer.valueOf(0));
/* 149:    */         }
/* 150:    */       }
/* 151:177 */       rMap.put("datas", datas);
/* 152:    */     }
/* 153:    */     catch (Exception ex)
/* 154:    */     {
/* 155:181 */       rMap.put("success", Boolean.valueOf(false));
/* 156:183 */       if (MapUtil.getBoolean(rMap, "shoeExMessage").booleanValue()) {
/* 157:185 */         rMap.put("message", ex.getMessage());
/* 158:    */       } else {
/* 159:189 */         rMap.put("message", "展示数据列表出错！请稍后重试，或联系系统管理员！");
/* 160:    */       }
/* 161:192 */       rMap.put("ex", ex.getMessage());
/* 162:    */       
/* 163:194 */       ex.printStackTrace();
/* 164:    */     }
/* 165:197 */     afterList(model, rMap);
/* 166:    */     
/* 167:199 */     return datas;
/* 168:    */   }
/* 169:    */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.app.zhcx.qycx.ZhcxQycxService
 * JD-Core Version:    0.7.0.1
 */